#ifndef SALEDETAIL_H
#define SALEDETAIL_H
#include "commodity.h"
#include <QList>

class SaleDetail : public Commodity
{
public:
    SaleDetail();
    SaleDetail & operator =(const SaleDetail &other)
    {
        if (this == &other)
            return *this;
        Commodity::operator =(other);

        m_saleSum = other.m_saleSum;
        m_saleStaffName = other.m_saleStaffName;
        m_saleQuantity = other.m_saleQuantity;
        m_originalPrice = other.m_originalPrice;
        m_realDiscount = other.m_realDiscount;
        m_realSellingPrice = other.m_realSellingPrice;
        m_saleDate = other.m_saleDate;
        m_integration = other.m_integration;

        return *this;
    }
    SaleDetail(const QString commodityBarcode, const QString commodityName, const QString cost,
               const QString discount, const QString saleQuantity,  const QString sellingPrice,
               const QString memberPrice, const QString realSellingPrice, const QString saleSum,
               const QString saleStaffName, const bool integration, const QString stockQuantity,
               const QString originalPrice)
        :Commodity(commodityBarcode, commodityName, cost, discount,
                   sellingPrice, memberPrice, realSellingPrice, stockQuantity)
    {
        m_saleSum = saleSum;
        m_saleStaffName = saleStaffName;
        m_saleQuantity = saleQuantity;
        m_integration = integration;
        m_originalPrice = originalPrice;
    }

    SaleDetail(const QString commodityBarcode, const QString discount, const QString saleQuantity,
               const QString realPrice, const QString saleSum)
        :Commodity(commodityBarcode, realPrice, discount)
    {
        m_saleQuantity = saleQuantity;
        m_saleSum = saleSum;
    }

    SaleDetail(const QString commodityBarcode, const QString commodityName,
               const QString internalCode, const QString unitNumber,
               const QString sellingPrice, const QString realDiscount,
               const QString realSellingPrice, const QString saleQuantity,
               const QString saleSum, bool integration,
               const QString saleStaffName/*, const QString saleDate*/)
        :Commodity(commodityBarcode, commodityName, internalCode,
                   unitNumber, sellingPrice)
    {
        m_realDiscount = realDiscount;
        m_realSellingPrice = realSellingPrice;
        m_saleQuantity = saleQuantity;
        m_saleSum = saleSum;
        m_integration = integration;
        m_saleStaffName = saleStaffName;
//        m_saleDate = saleDate;
    }

    QString get_saleSum() const {return m_saleSum;}
    QString get_saleStaffName() const {return m_saleStaffName;}
    QString get_saleQuantity() const {return m_saleQuantity;}
    QString get_originalPrice() const {return m_originalPrice;}
    bool get_integration() const {return m_integration;}
    QString get_realDiscount() const {return m_realDiscount;}
    QString get_realSellingPrice() const {return m_realSellingPrice;}
    QString get_saleDate() const {return m_saleDate;}

    void set_integration(bool integration) {m_integration = integration;}
    void set_saleSum(const QString &saleSum) {m_saleSum = saleSum;}
    void set_saleStaffName(const QString &saleStaffName) {m_saleStaffName = saleStaffName;}
    void set_saleQuantity(const QString &saleQuantity) {m_saleQuantity = saleQuantity;}
    void set_originalPrice(const QString &originalPrice) {m_originalPrice = originalPrice;}
    void set_realDiscount(const QString &realDiscount) {m_realDiscount = realDiscount;}
    void set_realSellingPrice(const QString &realSellingPrice)
    {m_realSellingPrice = realSellingPrice;}
    void set_saleDate(const QString &saleDate) {m_saleDate = saleDate;}

private:
    QString m_saleSum;
    QString m_saleStaffName;
    QString m_saleQuantity;
    QString m_originalPrice;

    QString m_realDiscount;
    QString m_realSellingPrice;
    QString m_saleDate;

    bool m_integration;
};

typedef QList <SaleDetail> saleDetailList;
#endif // SALEDETAIL_H
